package lily.phs.urh;

import lily.phs.database.Constants;
import lily.phs.object.HereTipa;
import lily.phs.object.PersonInfo;
import lily.phs.urh.R;


import android.content.Context;
import android.graphics.Paint;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
//import android.widget.CheckBox;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

public class BuilderView_2 extends RelativeLayout implements OnClickListener,Constants{
	View v;
	LinearLayout ll1;
	//ScrollView sv;
	TextView tv;
	Paint paint;
	private int ft=0;  //家族史父亲选择个数
	private int mt=0;  //家族史母亲选择个数
	private int bs=0;   //家族兄弟姐妹选择个数
	private int sd=0;   //家族史子女选择个数
	private int ds=0;   //残疾情况
	private Context myContext;
	private TextView tv_pein_family_his_ft;
	private CheckBox cb_pein_family_his_ft_none,cb_pein_family_his_ft_hypertension,
					 cb_pein_family_his_ft_tangniaobing,cb_pein_family_his_ft_coronary,
					 cb_pein_family_his_ft_lung,cb_pein_family_his_ft_stroke,
					 cb_pein_family_his_ft_cancer,cb_pein_family_his_ft_mental,
					 cb_pein_family_his_ft_tuberculosis,cb_pein_family_his_ft_hepatitis,
					 cb_pein_family_his_ft_congmal,cb_pein_family_his_ft_ot;
	private EditText et_pein_family_his_ft_ot;	
	private TextView tv_pein_family_his_mt;
	private CheckBox cb_pein_family_his_mt_none,cb_pein_family_his_mt_hypertension,
					 cb_pein_family_his_mt_tangniaobing,cb_pein_family_his_mt_coronary,
					 cb_pein_family_his_mt_lung,cb_pein_family_his_mt_stroke,
					 cb_pein_family_his_mt_cancer,cb_pein_family_his_mt_mental,
					 cb_pein_family_his_mt_tuberculosis,cb_pein_family_his_mt_hepatitis,
					 cb_pein_family_his_mt_congmal,cb_pein_family_his_mt_ot;
	private EditText et_pein_family_his_mt_ot;
	private TextView tv_pein_family_his_bs;
	private CheckBox cb_pein_family_his_bs_none,cb_pein_family_his_bs_hypertension,
					 cb_pein_family_his_bs_tangniaobing,cb_pein_family_his_bs_coronary,
					 cb_pein_family_his_bs_lung,cb_pein_family_his_bs_stroke,
					 cb_pein_family_his_bs_cancer,cb_pein_family_his_bs_mental,
					 cb_pein_family_his_bs_tuberculosis,cb_pein_family_his_bs_hepatitis,
					 cb_pein_family_his_bs_congmal,cb_pein_family_his_bs_ot;
	private EditText et_pein_family_his_bs_ot;
	private TextView tv_pein_family_his_sd;
	private CheckBox cb_pein_family_his_sd_none,cb_pein_family_his_sd_hypertension,
					 cb_pein_family_his_sd_tangniaobing,cb_pein_family_his_sd_coronary,
					 cb_pein_family_his_sd_lung,cb_pein_family_his_sd_stroke,
					 cb_pein_family_his_sd_cancer,cb_pein_family_his_sd_mental,
					 cb_pein_family_his_sd_tuberculosis,cb_pein_family_his_sd_hepatitis,
					 cb_pein_family_his_sd_congmal,cb_pein_family_his_sd_ot;
	private EditText et_pein_family_his_sd_ot;
	
	private TextView tv_pein_hereditary_his;
	private RadioGroup rg_pein_hereditary;
	private RadioButton rb_pein_nonehereditary,rb_pein_hereditary;
	private EditText et_pein_hereditary_name;
	private TextView tv_pein_disable_situ;
	private CheckBox cb_pein_nonedisable,cb_pein_visual_disable,cb_pein_hear_disable,
				 	 cb_pein_language_disable,cb_pein_limbs_disable,cb_pein_brains_disable,
					 cb_pein_spirit_disable,cb_pein_other_disable;
	private EditText et_pein_other_disable;
	private RadioGroup rg_pein_live_kit;
	private RadioButton rb_pein_live_kit_none,rb_pein_live_kit_ranghood,
						rb_pein_live_kit_ventilator,rb_pein_live_kit_chimney;
	private RadioGroup rg_pein_live_fuel;
	private RadioButton rb_pein_live_fuel_liquefiedgas,rb_pein_live_fuel_coal,
						rb_pein_live_fuel_natgas,rb_pein_live_fuel_methane,
						rb_pein_live_fuel_firewood,rb_pein_live_fuel_other;
	private RadioGroup rg_pein_live_water;
	private RadioButton rb_pein_live_water_tapwater,rb_pein_live_water_refine,
						rb_pein_live_water_well,rb_pein_live_water_river,
						rb_pein_live_water_pond,rb_pein_live_water_other;
	private RadioGroup rg_pein_live_toilet;
	private RadioButton rb_pein_live_toilet_safelatrine,rb_pein_live_toilet_cellpool,
						rb_pein_live_toilet_closestool,rb_pein_live_toilet_opencellpool,rb_pein_live_toilet_portabletoilet;
	private RadioGroup rg_pein_live_stock;
	private RadioButton rb_pein_live_stock_danshe,rb_pein_live_stock_inroom,rb_pein_live_stock_outroom;
	private PersonInfo person;
	private int profileid=0;//健康档案编号
	
	public BuilderView_2(Context context){
		super(context);
		this.myContext = context;
		LayoutInflater factory = LayoutInflater.from(myContext);
		v=factory.inflate(R.layout.person_info2, null);
		findViewsById();
		initialize();
		LayoutParams lp=new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);  
	    this.addView(v,lp);
		person=new PersonInfo(myContext);
	}
	
	private void initialize() {
		// TODO Auto-generated method stub
		cb_pein_family_his_ft_none.setChecked(true);
		cb_pein_family_his_mt_none.setChecked(true);
		cb_pein_family_his_bs_none.setChecked(true);
		cb_pein_family_his_sd_none.setChecked(true);
		rb_pein_nonehereditary.setChecked(true);
		cb_pein_nonedisable.setChecked(true);
		rb_pein_live_kit_none.setChecked(true);
		rb_pein_live_fuel_coal.setChecked(true);
		rb_pein_live_water_tapwater.setChecked(true);
		rb_pein_live_toilet_portabletoilet.setChecked(true);
		rb_pein_live_stock_outroom.setChecked(true);
	}

	public void setProfileid(int id){
		this.profileid = id;
	}

	private void findViewsById(){
		
		ll1=(LinearLayout)v.findViewById(R.id.fam_eco_hushuxing);
	       tv_pein_family_his_ft=(TextView)v.findViewById(R.id.tv_pein_family_his_ft);
	       cb_pein_family_his_ft_none=(CheckBox)v.findViewById(R.id.cb_pein_family_his_ft_none);
	       cb_pein_family_his_ft_hypertension=(CheckBox)v.findViewById(R.id.cb_pein_family_his_ft_hypertension);
			cb_pein_family_his_ft_tangniaobing=(CheckBox)v.findViewById(R.id.cb_pein_family_his_ft_tangniaobing);
			cb_pein_family_his_ft_coronary=(CheckBox)v.findViewById(R.id.cb_pein_family_his_ft_coronary);
			cb_pein_family_his_ft_lung=(CheckBox)v.findViewById(R.id.cb_pein_family_his_ft_lung);
			cb_pein_family_his_ft_stroke=(CheckBox)v.findViewById(R.id.cb_pein_family_his_ft_stroke);
			cb_pein_family_his_ft_cancer=(CheckBox)v.findViewById(R.id.cb_pein_family_his_ft_cancer);
		    cb_pein_family_his_ft_mental=(CheckBox)v.findViewById(R.id.cb_pein_family_his_ft_mental);
			cb_pein_family_his_ft_tuberculosis=(CheckBox)v.findViewById(R.id.cb_pein_family_his_ft_tuberculosis);
			cb_pein_family_his_ft_hepatitis=(CheckBox)v.findViewById(R.id.cb_pein_family_his_ft_hepatitis);
			cb_pein_family_his_ft_congmal=(CheckBox)v.findViewById(R.id.cb_pein_family_his_ft_congmal);
			cb_pein_family_his_ft_ot=(CheckBox)v.findViewById(R.id.cb_pein_family_his_ft_ot);
			et_pein_family_his_ft_ot=(EditText)v.findViewById(R.id.et_pein_family_his_ft_ot);
			cb_pein_family_his_ft_none.setOnClickListener(this);
			cb_pein_family_his_ft_hypertension.setOnClickListener(this);
			cb_pein_family_his_ft_tangniaobing.setOnClickListener(this);
			cb_pein_family_his_ft_coronary.setOnClickListener(this);
			cb_pein_family_his_ft_lung.setOnClickListener(this);
			cb_pein_family_his_ft_stroke.setOnClickListener(this);
			cb_pein_family_his_ft_cancer.setOnClickListener(this);
			cb_pein_family_his_ft_mental.setOnClickListener(this);
			cb_pein_family_his_ft_tuberculosis.setOnClickListener(this);
			cb_pein_family_his_ft_hepatitis.setOnClickListener(this);
			cb_pein_family_his_ft_congmal.setOnClickListener(this);
			cb_pein_family_his_ft_ot.setOnClickListener(this);
			tv_pein_family_his_mt=(TextView)v.findViewById(R.id.tv_pein_family_his_mt);
			cb_pein_family_his_mt_none=(CheckBox)v.findViewById(R.id.cb_pein_family_his_mt_none);
			cb_pein_family_his_mt_hypertension=(CheckBox)v.findViewById(R.id.cb_pein_family_his_mt_hypertension);
			cb_pein_family_his_mt_tangniaobing=(CheckBox)v.findViewById(R.id.cb_pein_family_his_mt_tangniaobing);
			cb_pein_family_his_mt_coronary=(CheckBox)v.findViewById(R.id.cb_pein_family_his_mt_coronary);
			cb_pein_family_his_mt_lung=(CheckBox)v.findViewById(R.id.cb_pein_family_his_mt_lung);
			cb_pein_family_his_mt_stroke=(CheckBox)v.findViewById(R.id.cb_pein_family_his_mt_stroke);
			cb_pein_family_his_mt_cancer=(CheckBox)v.findViewById(R.id.cb_pein_family_his_mt_cancer);
			cb_pein_family_his_mt_mental=(CheckBox)v.findViewById(R.id.cb_pein_family_his_mt_mental);
			cb_pein_family_his_mt_tuberculosis=(CheckBox)v.findViewById(R.id.cb_pein_family_his_mt_tuberculosis);
			cb_pein_family_his_mt_hepatitis=(CheckBox)v.findViewById(R.id.cb_pein_family_his_mt_hepatitis);
			cb_pein_family_his_mt_congmal=(CheckBox)v.findViewById(R.id.cb_pein_family_his_mt_congmal);
			cb_pein_family_his_mt_ot=(CheckBox)v.findViewById(R.id.cb_pein_family_his_mt_ot);
			et_pein_family_his_mt_ot=(EditText)v.findViewById(R.id.et_pein_family_his_mt_ot);
			cb_pein_family_his_mt_none.setOnClickListener(this);
			cb_pein_family_his_mt_hypertension.setOnClickListener(this);
			cb_pein_family_his_mt_tangniaobing.setOnClickListener(this);
			cb_pein_family_his_mt_coronary.setOnClickListener(this);
			cb_pein_family_his_mt_lung.setOnClickListener(this);
			cb_pein_family_his_mt_stroke.setOnClickListener(this);
			cb_pein_family_his_mt_cancer.setOnClickListener(this);
			cb_pein_family_his_mt_mental.setOnClickListener(this);
			cb_pein_family_his_mt_tuberculosis.setOnClickListener(this);
			cb_pein_family_his_mt_hepatitis.setOnClickListener(this);
			cb_pein_family_his_mt_congmal.setOnClickListener(this);
			cb_pein_family_his_mt_ot.setOnClickListener(this);
//			tv_pein_family_his_bs=(TextView)v.findViewById(R.id.tv_pein_family_his_bs);
			cb_pein_family_his_bs_none=(CheckBox)v.findViewById(R.id.cb_pein_family_his_bs_none);
			cb_pein_family_his_bs_hypertension=(CheckBox)v.findViewById(R.id.cb_pein_family_his_bs_hypertension);
			cb_pein_family_his_bs_tangniaobing=(CheckBox)v.findViewById(R.id.cb_pein_family_his_bs_tangniaobing);
			cb_pein_family_his_bs_coronary=(CheckBox)v.findViewById(R.id.cb_pein_family_his_bs_coronary);
			cb_pein_family_his_bs_lung=(CheckBox)v.findViewById(R.id.cb_pein_family_his_bs_lung);
			cb_pein_family_his_bs_stroke=(CheckBox)v.findViewById(R.id.cb_pein_family_his_bs_stroke);
			cb_pein_family_his_bs_cancer=(CheckBox)v.findViewById(R.id.cb_pein_family_his_bs_cancer);
			cb_pein_family_his_bs_mental=(CheckBox)v.findViewById(R.id.cb_pein_family_his_bs_mental);
			cb_pein_family_his_bs_tuberculosis=(CheckBox)v.findViewById(R.id.cb_pein_family_his_bs_tuberculosis);
			cb_pein_family_his_bs_hepatitis=(CheckBox)v.findViewById(R.id.cb_pein_family_his_bs_hepatitis);
			cb_pein_family_his_bs_congmal=(CheckBox)v.findViewById(R.id.cb_pein_family_his_bs_congmal);
			cb_pein_family_his_bs_ot=(CheckBox)v.findViewById(R.id.cb_pein_family_his_bs_ot);
			et_pein_family_his_bs_ot=(EditText)v.findViewById(R.id.et_pein_family_his_bs_ot);
			cb_pein_family_his_bs_none.setOnClickListener(this);
			cb_pein_family_his_bs_hypertension.setOnClickListener(this);
			cb_pein_family_his_bs_tangniaobing.setOnClickListener(this);
			cb_pein_family_his_bs_coronary.setOnClickListener(this);
			cb_pein_family_his_bs_lung.setOnClickListener(this);
			cb_pein_family_his_bs_stroke.setOnClickListener(this);
			cb_pein_family_his_bs_cancer.setOnClickListener(this);
			cb_pein_family_his_bs_mental.setOnClickListener(this);
			cb_pein_family_his_bs_tuberculosis.setOnClickListener(this);
			cb_pein_family_his_bs_hepatitis.setOnClickListener(this);
			cb_pein_family_his_bs_congmal.setOnClickListener(this);
			cb_pein_family_his_bs_ot.setOnClickListener(this);
			tv_pein_family_his_sd=(TextView)v.findViewById(R.id.tv_pein_family_his_sd);
			cb_pein_family_his_sd_none=(CheckBox)v.findViewById(R.id.cb_pein_family_his_sd_none);
			cb_pein_family_his_sd_hypertension=(CheckBox)v.findViewById(R.id.cb_pein_family_his_sd_hypertension);
			cb_pein_family_his_sd_tangniaobing=(CheckBox)v.findViewById(R.id.cb_pein_family_his_sd_tangniaobing);
			cb_pein_family_his_sd_coronary=(CheckBox)v.findViewById(R.id.cb_pein_family_his_sd_coronary);
			cb_pein_family_his_sd_lung=(CheckBox)v.findViewById(R.id.cb_pein_family_his_sd_lung);
			cb_pein_family_his_sd_stroke=(CheckBox)v.findViewById(R.id.cb_pein_family_his_sd_stroke);
			cb_pein_family_his_sd_cancer=(CheckBox)v.findViewById(R.id.cb_pein_family_his_sd_cancer);
			cb_pein_family_his_sd_mental=(CheckBox)v.findViewById(R.id.cb_pein_family_his_sd_mental);
			cb_pein_family_his_sd_tuberculosis=(CheckBox)v.findViewById(R.id.cb_pein_family_his_sd_tuberculosis);
			cb_pein_family_his_sd_hepatitis=(CheckBox)v.findViewById(R.id.cb_pein_family_his_sd_hepatitis);
			cb_pein_family_his_sd_congmal=(CheckBox)v.findViewById(R.id.cb_pein_family_his_sd_congmal);
			cb_pein_family_his_sd_ot=(CheckBox)v.findViewById(R.id.cb_pein_family_his_sd_ot);
			et_pein_family_his_sd_ot=(EditText)v.findViewById(R.id.et_pein_family_his_sd_ot);
			cb_pein_family_his_sd_none.setOnClickListener(this);
			cb_pein_family_his_sd_hypertension.setOnClickListener(this);
			cb_pein_family_his_sd_tangniaobing.setOnClickListener(this);
			cb_pein_family_his_sd_coronary.setOnClickListener(this);
			cb_pein_family_his_sd_lung.setOnClickListener(this);
			cb_pein_family_his_sd_stroke.setOnClickListener(this);
			cb_pein_family_his_sd_cancer.setOnClickListener(this);
			cb_pein_family_his_sd_mental.setOnClickListener(this);
			cb_pein_family_his_sd_tuberculosis.setOnClickListener(this);
			cb_pein_family_his_sd_hepatitis.setOnClickListener(this);
			cb_pein_family_his_sd_congmal.setOnClickListener(this);
			cb_pein_family_his_sd_ot.setOnClickListener(this);
			tv_pein_hereditary_his=(TextView)v.findViewById(R.id.tv_pein_hereditary_his);
			rg_pein_hereditary=(RadioGroup)v.findViewById(R.id.rg_pein_hereditary_his);
			rb_pein_nonehereditary=(RadioButton)v.findViewById(R.id.rb_pein_nonehereditary);
			rb_pein_nonehereditary.setOnClickListener(this);
			rb_pein_hereditary=(RadioButton)v.findViewById(R.id.rb_pein_hereditary);
			rb_pein_hereditary.setOnClickListener(this);
			et_pein_hereditary_name=(EditText)v.findViewById(R.id.et_pein_hereditary_name);
			tv_pein_disable_situ=(TextView)v.findViewById(R.id.tv_pein_disable_situ);
			cb_pein_nonedisable=(CheckBox)v.findViewById(R.id.cb_pein_nonedisable);
			cb_pein_visual_disable=(CheckBox)v.findViewById(R.id.cb_pein_visual_disable);
			cb_pein_hear_disable=(CheckBox)v.findViewById(R.id.cb_pein_hear_disable);
			cb_pein_language_disable=(CheckBox)v.findViewById(R.id.cb_pein_language_disable);
			cb_pein_limbs_disable=(CheckBox)v.findViewById(R.id.cb_pein_limbs_disable);
			cb_pein_brains_disable=(CheckBox)v.findViewById(R.id.cb_pein_brains_disable);
			cb_pein_spirit_disable=(CheckBox)v.findViewById(R.id.cb_pein_spirit_disable);
			cb_pein_other_disable=(CheckBox)v.findViewById(R.id.cb_pein_other_disable);
			cb_pein_nonedisable.setOnClickListener(this);
			cb_pein_visual_disable.setOnClickListener(this);
			cb_pein_hear_disable.setOnClickListener(this);
		 	cb_pein_language_disable.setOnClickListener(this);
		 	cb_pein_limbs_disable.setOnClickListener(this);
		 	cb_pein_brains_disable.setOnClickListener(this);
			cb_pein_spirit_disable.setOnClickListener(this);
			cb_pein_other_disable.setOnClickListener(this);
			et_pein_other_disable=(EditText)v.findViewById(R.id.et_pein_other_disable);
			rg_pein_live_kit=(RadioGroup)v.findViewById(R.id.rg_pein_live_kit);
			rb_pein_live_kit_none=(RadioButton)v.findViewById(R.id.rb_pein_live_kit_none);
			rb_pein_live_kit_ranghood=(RadioButton)v.findViewById(R.id.rb_pein_live_kit_ranghood);
			rb_pein_live_kit_ventilator=(RadioButton)v.findViewById(R.id.rb_pein_live_kit_ventilator);
			rb_pein_live_kit_chimney=(RadioButton)v.findViewById(R.id.rb_pein_live_kit_chimney);
			rg_pein_live_fuel=(RadioGroup)v.findViewById(R.id.rg_pein_live_fuel);
			rb_pein_live_fuel_liquefiedgas=(RadioButton)v.findViewById(R.id.rb_pein_live_fuel_liquefiedgas);
			rb_pein_live_fuel_coal=(RadioButton)v.findViewById(R.id.rb_pein_live_fuel_coal);
			rb_pein_live_fuel_natgas=(RadioButton)v.findViewById(R.id.rb_pein_live_fuel_natgas);
			rb_pein_live_fuel_methane=(RadioButton)v.findViewById(R.id.rb_pein_live_fuel_methane);
			rb_pein_live_fuel_firewood=(RadioButton)v.findViewById(R.id.rb_pein_live_fuel_firewood);
			rb_pein_live_fuel_other=(RadioButton)v.findViewById(R.id.rb_pein_live_fuel_other);
			rg_pein_live_water=(RadioGroup)v.findViewById(R.id.rg_pein_live_water);
			rb_pein_live_water_tapwater=(RadioButton)v.findViewById(R.id.rb_pein_live_water_tapwater);
			rb_pein_live_water_refine=(RadioButton)v.findViewById(R.id.rb_pein_live_water_refine);
			rb_pein_live_water_well=(RadioButton)v.findViewById(R.id.rb_pein_live_water_well);
			rb_pein_live_water_river=(RadioButton)v.findViewById(R.id.rb_pein_live_water_river);
			rb_pein_live_water_pond=(RadioButton)v.findViewById(R.id.rb_pein_live_water_pond);
			rb_pein_live_water_other=(RadioButton)v.findViewById(R.id.rb_pein_live_water_other);
			rg_pein_live_toilet=(RadioGroup)v.findViewById(R.id.rg_pein_live_toilet);
			rb_pein_live_toilet_safelatrine=(RadioButton)v.findViewById(R.id.rb_pein_live_toilet_safelatrine);
			rb_pein_live_toilet_cellpool=(RadioButton)v.findViewById(R.id.rb_pein_live_toilet_cellpool);
			rb_pein_live_toilet_closestool=(RadioButton)v.findViewById(R.id.rb_pein_live_toilet_closestool);
			rb_pein_live_toilet_opencellpool=(RadioButton)v.findViewById(R.id.rb_pein_live_toilet_opencellpool);
			rb_pein_live_toilet_portabletoilet=(RadioButton)v.findViewById(R.id.rb_pein_live_toilet_portabletoilet);
			rg_pein_live_stock=(RadioGroup)v.findViewById(R.id.rg_pein_live_stock);
			rb_pein_live_stock_danshe=(RadioButton)v.findViewById(R.id.rb_pein_live_stock_danshe);
			rb_pein_live_stock_inroom=(RadioButton)v.findViewById(R.id.rb_pein_live_stock_inroom);
			rb_pein_live_stock_outroom=(RadioButton)v.findViewById(R.id.rb_pein_live_stock_outroom);
			
			//pi=new PersonInfo(myContext);
			//pi.selectPersonInfo(profileid);
	}
	
	//保存
	public void saveViews(){
 	    person.selectPersonInfo(profileid);
 	    
 	    person.setPein_family_his_ft(pein_family_his_ft());
 	    if(cb_pein_family_his_ft_ot.isChecked()){
 	    	person.setPein_family_his_ft_ot(et_pein_family_his_ft_ot.getText().toString());
 	    }
 	    person.setPein_family_his_mt(pein_family_his_mt());
 	   if(cb_pein_family_his_mt_ot.isChecked()){
	    	person.setPein_family_his_mt_ot(et_pein_family_his_mt_ot.getText().toString());
	    }
 	    person.setPein_family_his_bs(pein_family_his_bs());
 	   if(cb_pein_family_his_bs_ot.isChecked()){
	    	person.setPein_family_his_bs_ot(et_pein_family_his_bs_ot.getText().toString());
	    }
 	    person.setPein_family_his_sd(pein_family_his_sd());
 	   if(cb_pein_family_his_sd_ot.isChecked()){
	    	person.setPein_family_his_sd_ot(et_pein_family_his_sd_ot.getText().toString());
	    }
 	   if(rb_pein_nonehereditary.isChecked()){person.setPein_hereditary_his(1);}
 	   else if(rb_pein_hereditary.isChecked()){
 		   person.setPein_hereditary_name(et_pein_hereditary_name.getText().toString());
 		   person.setPein_hereditary_his(2);
 	   }
 
 	  person.setPein_disable_situ(pein_disable_situ());
 	   if(cb_pein_other_disable.isChecked()){
 		   person.setPein_disable_situ_ot(et_pein_other_disable.getText().toString());
 	   }
 	   	if(rb_pein_live_kit_none.isChecked()){person.setPein_live_kit(1);}
		else if(rb_pein_live_kit_ranghood.isChecked()){person.setPein_live_kit(2);}
		else if(rb_pein_live_kit_ventilator.isChecked()){person.setPein_live_kit(3);}
		else if(rb_pein_live_kit_chimney.isChecked()){person.setPein_live_kit(4);}
 	  	if(rb_pein_live_fuel_liquefiedgas.isChecked()){person.setPein_live_fuel(1);}
		else if(rb_pein_live_fuel_coal.isChecked()){person.setPein_live_fuel(2);}
		else if(rb_pein_live_fuel_natgas.isChecked()){person.setPein_live_fuel(3);}
		else if(rb_pein_live_fuel_methane.isChecked()){person.setPein_live_fuel(4);}
		else if(rb_pein_live_fuel_firewood.isChecked()){person.setPein_live_fuel(5);}
		else if(rb_pein_live_fuel_other.isChecked()){person.setPein_live_fuel(6);}
	 	if(rb_pein_live_water_tapwater.isChecked()){person.setPein_live_water(1);}
	 	else if(rb_pein_live_water_refine.isChecked()){person.setPein_live_water(2);}
		else if(rb_pein_live_water_well.isChecked()){person.setPein_live_water(3);}
		else if(rb_pein_live_water_river.isChecked()){person.setPein_live_water(4);}
		else if(rb_pein_live_water_pond.isChecked()){person.setPein_live_water(5);}
		else if(rb_pein_live_water_other.isChecked()){person.setPein_live_water(6);}
	 	if(rb_pein_live_toilet_safelatrine.isChecked()){person.setPein_live_toilet(1);}
		else if(rb_pein_live_toilet_cellpool.isChecked()){person.setPein_live_toilet(2);}
		else if(rb_pein_live_toilet_closestool.isChecked()){person.setPein_live_toilet(3);}
		else if(rb_pein_live_toilet_opencellpool.isChecked()){person.setPein_live_toilet(4);}
		else if(rb_pein_live_toilet_portabletoilet.isChecked()){person.setPein_live_toilet(5);}
	 	if(rb_pein_live_stock_danshe.isChecked()){person.setPein_live_stock(1);}
		else if(rb_pein_live_stock_inroom.isChecked()){person.setPein_live_stock(2);}
		else if(rb_pein_live_stock_outroom.isChecked()){person.setPein_live_stock(3);}
	 	person.updatePersonInfo(profileid);
	}
	
	public String pein_family_his_ft(){
		CheckBox []cb_pein_family_his_ft_arr={cb_pein_family_his_ft_none,cb_pein_family_his_ft_hypertension,
										 cb_pein_family_his_ft_tangniaobing,cb_pein_family_his_ft_coronary,
										 cb_pein_family_his_ft_lung,cb_pein_family_his_ft_stroke,
										 cb_pein_family_his_ft_cancer,cb_pein_family_his_ft_mental,
										 cb_pein_family_his_ft_tuberculosis,cb_pein_family_his_ft_hepatitis,
										 cb_pein_family_his_ft_congmal,cb_pein_family_his_ft_ot};
		String r="";
		String m="";
			for(int i=0;i<cb_pein_family_his_ft_arr.length;i++){
				if(cb_pein_family_his_ft_arr[i].isChecked()){
					m=Integer.toString(i+1);
					r=r+m+",";	
				}
			}
		
		return r;
	}
	public String pein_family_his_mt(){
		CheckBox []cb_pein_family_his_mt_arr={cb_pein_family_his_mt_none,cb_pein_family_his_mt_hypertension,
				 cb_pein_family_his_mt_tangniaobing,cb_pein_family_his_mt_coronary,
				 cb_pein_family_his_mt_lung,cb_pein_family_his_mt_stroke,
				 cb_pein_family_his_mt_cancer,cb_pein_family_his_mt_mental,
				 cb_pein_family_his_mt_tuberculosis,cb_pein_family_his_mt_hepatitis,
				 cb_pein_family_his_mt_congmal,cb_pein_family_his_mt_ot};
		String r="";
		String m="";
	
			for(int i=0;i<cb_pein_family_his_mt_arr.length;i++){
				if(cb_pein_family_his_mt_arr[i].isChecked()){
					m=Integer.toString(i+1);
					r=r+m+",";
				}
			}	
		return r;
	}
	public String pein_family_his_bs(){
		CheckBox []cb_pein_family_his_bs_arr={cb_pein_family_his_bs_none,cb_pein_family_his_bs_hypertension,
				 cb_pein_family_his_bs_tangniaobing,cb_pein_family_his_bs_coronary,
				 cb_pein_family_his_bs_lung,cb_pein_family_his_bs_stroke,
				 cb_pein_family_his_bs_cancer,cb_pein_family_his_bs_mental,
				 cb_pein_family_his_bs_tuberculosis,cb_pein_family_his_bs_hepatitis,
				 cb_pein_family_his_bs_congmal,cb_pein_family_his_bs_ot};
		String r="";
		String m="";

			for(int i=0;i<cb_pein_family_his_bs_arr.length;i++){
				if(cb_pein_family_his_bs_arr[i].isChecked()){
					m=Integer.toString(i+1);
					r=r+m+",";
				}
			}
		return r;
	}
	public String pein_family_his_sd(){
		CheckBox []cb_pein_family_his_sd_arr={cb_pein_family_his_sd_none,cb_pein_family_his_sd_hypertension,
				 cb_pein_family_his_sd_tangniaobing,cb_pein_family_his_sd_coronary,
				 cb_pein_family_his_sd_lung,cb_pein_family_his_sd_stroke,
				 cb_pein_family_his_sd_cancer,cb_pein_family_his_sd_mental,
				 cb_pein_family_his_sd_tuberculosis,cb_pein_family_his_sd_hepatitis,
				 cb_pein_family_his_sd_congmal,cb_pein_family_his_sd_ot};
		String r="";
		String m="";
			for(int i=0;i<cb_pein_family_his_sd_arr.length;i++){
				if(cb_pein_family_his_sd_arr[i].isChecked()){
					m=Integer.toString(i+1);
					r=r+m+",";
				}
			}
		return r;
	}
	public String pein_disable_situ(){
		CheckBox []cb_disable_arr={cb_pein_nonedisable,cb_pein_visual_disable,cb_pein_hear_disable,
			 	 cb_pein_language_disable,cb_pein_limbs_disable,cb_pein_brains_disable,
				 cb_pein_spirit_disable,cb_pein_other_disable};
		String r="";
		String m="";
		for(int i=0;i<cb_disable_arr.length;i++){
			if(cb_disable_arr[i].isChecked()){
				m=Integer.toString(i+1);
				r=r+m+",";
			}
		}
		return r;
	}
	
    //为某些组件设置监听事件
    public void onClick(View v) {
    	if(v==cb_pein_family_his_ft_none){
    		cb_pein_family_his_ft_hypertension.setChecked(false);
    		cb_pein_family_his_ft_tangniaobing.setChecked(false);
    		cb_pein_family_his_ft_coronary.setChecked(false);
    		cb_pein_family_his_ft_lung.setChecked(false);
    		cb_pein_family_his_ft_stroke.setChecked(false);
    		cb_pein_family_his_ft_cancer.setChecked(false);
    		cb_pein_family_his_ft_mental.setChecked(false);
    		cb_pein_family_his_ft_tuberculosis.setChecked(false);
    		cb_pein_family_his_ft_hepatitis.setChecked(false);
    		cb_pein_family_his_ft_congmal.setChecked(false);
    		cb_pein_family_his_ft_ot.setChecked(false);
    		et_pein_family_his_ft_ot.setText("");
    		ft=0;
    	}
   
    	else if(v==cb_pein_family_his_ft_hypertension){
    		cb_pein_family_his_ft_none.setChecked(false);
    		if(cb_pein_family_his_ft_hypertension.isChecked()){
    			ft++;
    		}
    		else{
    			ft--;
    			}
    		if(ft>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_ft_hypertension.setChecked(false);
				ft--;
    		}
    	}
    	else if(v==cb_pein_family_his_ft_tangniaobing){
    		cb_pein_family_his_ft_none.setChecked(false);
    		if(cb_pein_family_his_ft_tangniaobing.isChecked()){
    			ft++;
    		}
    		else{
    			ft--;
    			}
    		if(ft>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_ft_tangniaobing.setChecked(false);
				ft--;
    		}
    	}
    	else if(v==cb_pein_family_his_ft_coronary){
    		cb_pein_family_his_ft_none.setChecked(false);
    		if(cb_pein_family_his_ft_coronary.isChecked()){
    			ft++;
    		}
    		else{
    			ft--;
    			}
    		if(ft>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_ft_coronary.setChecked(false);
				ft--;
    		}
    	}
    	else if(v==cb_pein_family_his_ft_lung){
    		cb_pein_family_his_ft_none.setChecked(false);
    		if(cb_pein_family_his_ft_lung.isChecked()){
    			ft++;
    		}
    		else{
    			ft--;
    			}
    		if(ft>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_ft_lung.setChecked(false);
				ft--;
    		}
    	}
    	else if(v==cb_pein_family_his_ft_stroke){
    		cb_pein_family_his_ft_none.setChecked(false);
    		if(cb_pein_family_his_ft_stroke.isChecked()){
    			ft++;
    		}
    		else{
    			ft--;
    			}
    		if(ft>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_ft_stroke.setChecked(false);
				ft--;
    		}
    	}
    	else if(v==cb_pein_family_his_ft_cancer){
    		cb_pein_family_his_ft_none.setChecked(false);
    		if(cb_pein_family_his_ft_cancer.isChecked()){
    			ft++;
    		}
    		else{
    			ft--;
    			}
    		if(ft>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_ft_cancer.setChecked(false);
				ft--;
    		}
    	}
    	else if(v==cb_pein_family_his_ft_mental){
    		cb_pein_family_his_ft_none.setChecked(false);
    		if(cb_pein_family_his_ft_mental.isChecked()){
    			ft++;
    		}
    		else{
    			ft--;
    			}
    		if(ft>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_ft_mental.setChecked(false);
				ft--;
    		}
    	}
    	else if(v==cb_pein_family_his_ft_tuberculosis){
    		cb_pein_family_his_ft_none.setChecked(false);
    		if(cb_pein_family_his_ft_tuberculosis.isChecked()){
    			ft++;
    		}
    		else{
    			ft--;
    			}
    		if(ft>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_ft_tuberculosis.setChecked(false);
				ft--;
    		}
    	}
    	else if(v==cb_pein_family_his_ft_hepatitis){
    		cb_pein_family_his_ft_none.setChecked(false);
    		if(cb_pein_family_his_ft_hepatitis.isChecked()){
    			ft++;
    		}
    		else{
    			ft--;
    			}
    		if(ft>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_ft_hepatitis.setChecked(false);
				ft--;
    		}
    	}
    	else if(v==cb_pein_family_his_ft_congmal){
    		cb_pein_family_his_ft_none.setChecked(false);
    		if(cb_pein_family_his_ft_congmal.isChecked()){
    			ft++;
    		}
    		else{
    			ft--;
    			}
    		if(ft>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_ft_congmal.setChecked(false);
				ft--;
    		}
    	}
    	else if(v==cb_pein_family_his_ft_ot){
    		cb_pein_family_his_ft_none.setChecked(false);
    		if(cb_pein_family_his_ft_ot.isChecked()){
    			ft++;
    			et_pein_family_his_ft_ot.requestFocus();
    			et_pein_family_his_ft_ot.setEnabled(true);
    		}
    		else{
    			ft--;
    			et_pein_family_his_ft_ot.setText("");
    			et_pein_family_his_ft_ot.setEnabled(false);
    			}
    		if(ft>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_ft_ot.setChecked(false);
				ft--;
    		}
    	}
    	else if(v==cb_pein_family_his_mt_none){
    	//	cb_pein_family_his_mt_none.setChecked(true);
    		cb_pein_family_his_mt_hypertension.setChecked(false);
    		cb_pein_family_his_mt_tangniaobing.setChecked(false);
    		cb_pein_family_his_mt_coronary.setChecked(false);
    		cb_pein_family_his_mt_lung.setChecked(false);
    		cb_pein_family_his_mt_stroke.setChecked(false);
    		cb_pein_family_his_mt_cancer.setChecked(false);
    		cb_pein_family_his_mt_mental.setChecked(false);
    		cb_pein_family_his_mt_tuberculosis.setChecked(false);
    		cb_pein_family_his_mt_hepatitis.setChecked(false);
    		cb_pein_family_his_mt_congmal.setChecked(false);
    		cb_pein_family_his_mt_ot.setChecked(false);
    		et_pein_family_his_mt_ot.setText("");
    		mt=0;
    	}
   
    	else if(v==cb_pein_family_his_mt_hypertension){
    		cb_pein_family_his_mt_none.setChecked(false);
    		if(cb_pein_family_his_mt_hypertension.isChecked()){
    			mt++;
    		}
    		else{
    			mt--;
    			}
    		if(mt>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_mt_hypertension.setChecked(false);
				mt--;
    		}
    	}
    	else if(v==cb_pein_family_his_mt_tangniaobing){
    		cb_pein_family_his_mt_none.setChecked(false);
    		if(cb_pein_family_his_mt_tangniaobing.isChecked()){
    			mt++;
    		}
    		else{
    			mt--;
    			}
    		if(mt>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_mt_tangniaobing.setChecked(false);
				mt--;
    		}
    	}
    	else if(v==cb_pein_family_his_mt_coronary){
    		cb_pein_family_his_mt_none.setChecked(false);
    		if(cb_pein_family_his_mt_coronary.isChecked()){
    			mt++;
    		}
    		else{
    			mt--;
    			}
    		if(mt>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_mt_coronary.setChecked(false);
				mt--;
    		}
    	}
    	else if(v==cb_pein_family_his_mt_lung){
    		cb_pein_family_his_mt_none.setChecked(false);
    		if(cb_pein_family_his_mt_lung.isChecked()){
    			mt++;
    		}
    		else{
    			mt--;
    			}
    		if(mt>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_mt_lung.setChecked(false);
				mt--;
    		}
    	}
    	else if(v==cb_pein_family_his_mt_stroke){
    		cb_pein_family_his_mt_none.setChecked(false);
    		if(cb_pein_family_his_mt_stroke.isChecked()){
    			mt++;
    		}
    		else{
    			mt--;
    			}
    		if(mt>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_mt_stroke.setChecked(false);
				mt--;
    		}
    	}
    	else if(v==cb_pein_family_his_mt_cancer){
    		cb_pein_family_his_mt_none.setChecked(false);
    		if(cb_pein_family_his_mt_cancer.isChecked()){
    			mt++;
    		}
    		else{
    			mt--;
    			}
    		if(mt>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_mt_cancer.setChecked(false);
				mt--;
    		}
    	}
    	else if(v==cb_pein_family_his_mt_mental){
    		cb_pein_family_his_mt_none.setChecked(false);
    		if(cb_pein_family_his_mt_mental.isChecked()){
    			mt++;
    		}
    		else{
    			mt--;
    			}
    		if(mt>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_mt_mental.setChecked(false);
				mt--;
    		}
    	}
    	else if(v==cb_pein_family_his_mt_tuberculosis){
    		cb_pein_family_his_mt_none.setChecked(false);
    		if(cb_pein_family_his_mt_tuberculosis.isChecked()){
    			mt++;
    		}
    		else{
    			mt--;
    			}
    		if(mt>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_mt_tuberculosis.setChecked(false);
				mt--;
    		}
    	}
    	else if(v==cb_pein_family_his_mt_hepatitis){
    		cb_pein_family_his_mt_none.setChecked(false);
    		if(cb_pein_family_his_mt_hepatitis.isChecked()){
    			mt++;
    		}
    		else{
    			mt--;
    			}
    		if(mt>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_mt_hepatitis.setChecked(false);
				mt--;
    		}
    	}
    	else if(v==cb_pein_family_his_mt_congmal){
    		cb_pein_family_his_mt_none.setChecked(false);
    		if(cb_pein_family_his_mt_congmal.isChecked()){
    			mt++;
    		}
    		else{
    			mt--;
    			}
    		if(mt>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_mt_congmal.setChecked(false);
				mt--;
    		}
    	}
    	else if(v==cb_pein_family_his_mt_ot){
    		cb_pein_family_his_mt_none.setChecked(false);
    		if(cb_pein_family_his_mt_ot.isChecked()){
    			mt++;
    			et_pein_family_his_mt_ot.setEnabled(true);
    			et_pein_family_his_mt_ot.requestFocus();
    		}
    		else{
    			mt--;
    			et_pein_family_his_mt_ot.setEnabled(false);
    			et_pein_family_his_mt_ot.setText("");
    			}
    		if(mt>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_mt_ot.setChecked(false);
				mt--;
    		}
    	}
    	else if(v==cb_pein_family_his_bs_none){
    		cb_pein_family_his_bs_hypertension.setChecked(false);
    		cb_pein_family_his_bs_tangniaobing.setChecked(false);
    		cb_pein_family_his_bs_coronary.setChecked(false);
    		cb_pein_family_his_bs_lung.setChecked(false);
    		cb_pein_family_his_bs_stroke.setChecked(false);
    		cb_pein_family_his_bs_cancer.setChecked(false);
    		cb_pein_family_his_bs_mental.setChecked(false);
    		cb_pein_family_his_bs_tuberculosis.setChecked(false);
    		cb_pein_family_his_bs_hepatitis.setChecked(false);
    		cb_pein_family_his_bs_congmal.setChecked(false);
    		cb_pein_family_his_bs_ot.setChecked(false);
    		et_pein_family_his_bs_ot.setText("");
    		bs=0;
    	}
   
    	else if(v==cb_pein_family_his_bs_hypertension){
    		cb_pein_family_his_bs_none.setChecked(false);
    		if(cb_pein_family_his_bs_hypertension.isChecked()){
    			bs++;
    		}
    		else{
    			bs--;
    			}
    		if(bs>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_bs_hypertension.setChecked(false);
				bs--;
    		}
    	}
    	else if(v==cb_pein_family_his_bs_tangniaobing){
    		cb_pein_family_his_bs_none.setChecked(false);
    		if(cb_pein_family_his_bs_tangniaobing.isChecked()){
    			bs++;
    		}
    		else{
    			bs--;
    			}
    		if(bs>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_bs_tangniaobing.setChecked(false);
				bs--;
    		}
    	}
    	else if(v==cb_pein_family_his_bs_coronary){
    		cb_pein_family_his_bs_none.setChecked(false);
    		if(cb_pein_family_his_bs_coronary.isChecked()){
    			bs++;
    		}
    		else{
    			bs--;
    			}
    		if(bs>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_bs_coronary.setChecked(false);
				bs--;
    		}
    	}
    	else if(v==cb_pein_family_his_bs_lung){
    		cb_pein_family_his_bs_none.setChecked(false);
    		if(cb_pein_family_his_bs_lung.isChecked()){
    			bs++;
    		}
    		else{
    			bs--;
    			}
    		if(bs>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_bs_lung.setChecked(false);
				bs--;
    		}
    	}
    	else if(v==cb_pein_family_his_bs_stroke){
    		cb_pein_family_his_bs_none.setChecked(false);
    		if(cb_pein_family_his_bs_stroke.isChecked()){
    			bs++;
    		}
    		else{
    			bs--;
    			}
    		if(bs>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_bs_stroke.setChecked(false);
				bs--;
    		}
    	}
    	else if(v==cb_pein_family_his_bs_cancer){
    		cb_pein_family_his_bs_none.setChecked(false);
    		if(cb_pein_family_his_bs_cancer.isChecked()){
    			bs++;
    		}
    		else{
    			bs--;
    			}
    		if(bs>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_bs_cancer.setChecked(false);
				bs--;
    		}
    	}
    	else if(v==cb_pein_family_his_bs_mental){
    		cb_pein_family_his_bs_none.setChecked(false);
    		if(cb_pein_family_his_bs_mental.isChecked()){
    			bs++;
    		}
    		else{
    			bs--;
    			}
    		if(bs>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_bs_mental.setChecked(false);
				bs--;
    		}
    	}
    	else if(v==cb_pein_family_his_bs_tuberculosis){
    		cb_pein_family_his_bs_none.setChecked(false);
    		if(cb_pein_family_his_bs_tuberculosis.isChecked()){
    			bs++;
    		}
    		else{
    			bs--;
    			}
    		if(bs>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_bs_tuberculosis.setChecked(false);
				bs--;
    		}
    	}
    	else if(v==cb_pein_family_his_bs_hepatitis){
    		cb_pein_family_his_bs_none.setChecked(false);
    		if(cb_pein_family_his_bs_hepatitis.isChecked()){
    			bs++;
    		}
    		else{
    			bs--;
    			}
    		if(bs>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_bs_hepatitis.setChecked(false);
				bs--;
    		}
    	}
    	else if(v==cb_pein_family_his_bs_congmal){
    		cb_pein_family_his_bs_none.setChecked(false);
    		if(cb_pein_family_his_bs_congmal.isChecked()){
    			bs++;
    		}
    		else{
    			bs--;
    			}
    		if(bs>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_bs_congmal.setChecked(false);
				bs--;
    		}
    	}
    	else if(v==cb_pein_family_his_bs_ot){
    		cb_pein_family_his_bs_none.setChecked(false);
    		if(cb_pein_family_his_bs_ot.isChecked()){
    			bs++;
    			et_pein_family_his_bs_ot.setEnabled(true);
    			et_pein_family_his_bs_ot.requestFocus();
    		}
    		else{
    			bs--;
    			et_pein_family_his_bs_ot.setEnabled(false);
    			et_pein_family_his_bs_ot.setText("");
    			}
    		if(bs>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_bs_ot.setChecked(false);
				bs--;
    		}
    	}
    	else if(v==cb_pein_family_his_sd_none){
    		cb_pein_family_his_sd_hypertension.setChecked(false);
    		cb_pein_family_his_sd_tangniaobing.setChecked(false);
    		cb_pein_family_his_sd_coronary.setChecked(false);
    		cb_pein_family_his_sd_lung.setChecked(false);
    		cb_pein_family_his_sd_stroke.setChecked(false);
    		cb_pein_family_his_sd_cancer.setChecked(false);
    		cb_pein_family_his_sd_mental.setChecked(false);
    		cb_pein_family_his_sd_tuberculosis.setChecked(false);
    		cb_pein_family_his_sd_hepatitis.setChecked(false);
    		cb_pein_family_his_sd_congmal.setChecked(false);
    		cb_pein_family_his_sd_ot.setChecked(false);
    		et_pein_family_his_sd_ot.setText("");
    		sd=0;
    	}
   
    	else if(v==cb_pein_family_his_sd_hypertension){
    		cb_pein_family_his_sd_none.setChecked(false);
    		if(cb_pein_family_his_sd_hypertension.isChecked()){
    			sd++;
    		}
    		else{
    			sd--;
    			}
    		if(sd>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_sd_hypertension.setChecked(false);
				sd--;
    		}
    	}
    	else if(v==cb_pein_family_his_sd_tangniaobing){
    		cb_pein_family_his_sd_none.setChecked(false);
    		if(cb_pein_family_his_sd_tangniaobing.isChecked()){
    			sd++;
    		}
    		else{
    			sd--;
    			}
    		if(sd>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_sd_tangniaobing.setChecked(false);
				sd--;
    		}
    	}
    	else if(v==cb_pein_family_his_sd_coronary){
    		cb_pein_family_his_sd_none.setChecked(false);
    		if(cb_pein_family_his_sd_coronary.isChecked()){
    			sd++;
    		}
    		else{
    			sd--;
    			}
    		if(sd>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_sd_coronary.setChecked(false);
				sd--;
    		}
    	}
    	else if(v==cb_pein_family_his_sd_lung){
    		cb_pein_family_his_sd_none.setChecked(false);
    		if(cb_pein_family_his_sd_lung.isChecked()){
    			sd++;
    		}
    		else{
    			sd--;
    			}
    		if(sd>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_sd_lung.setChecked(false);
				sd--;
    		}
    	}
    	else if(v==cb_pein_family_his_sd_stroke){
    		cb_pein_family_his_sd_none.setChecked(false);
    		if(cb_pein_family_his_sd_stroke.isChecked()){
    			sd++;
    		}
    		else{
    			sd--;
    			}
    		if(sd>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_sd_stroke.setChecked(false);
				sd--;
    		}
    	}
    	else if(v==cb_pein_family_his_sd_cancer){
    		cb_pein_family_his_sd_none.setChecked(false);
    		if(cb_pein_family_his_sd_cancer.isChecked()){
    			sd++;
    		}
    		else{
    			sd--;
    			}
    		if(sd>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_sd_cancer.setChecked(false);
				sd--;
    		}
    	}
    	else if(v==cb_pein_family_his_sd_mental){
    		cb_pein_family_his_sd_none.setChecked(false);
    		if(cb_pein_family_his_sd_mental.isChecked()){
    			sd++;
    		}
    		else{
    			sd--;
    			}
    		if(sd>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_sd_mental.setChecked(false);
				sd--;
    		}
    	}
    	else if(v==cb_pein_family_his_sd_tuberculosis){
    		cb_pein_family_his_sd_none.setChecked(false);
    		if(cb_pein_family_his_sd_tuberculosis.isChecked()){
    			sd++;
    		}
    		else{
    			sd--;
    			}
    		if(sd>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_sd_tuberculosis.setChecked(false);
				sd--;
    		}
    	}
    	else if(v==cb_pein_family_his_sd_hepatitis){
    		cb_pein_family_his_sd_none.setChecked(false);
    		if(cb_pein_family_his_sd_hepatitis.isChecked()){
    			sd++;
    		}
    		else{
    			sd--;
    			}
    		if(sd>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_sd_hepatitis.setChecked(false);
				sd--;
    		}
    	}
    	else if(v==cb_pein_family_his_sd_congmal){
    		cb_pein_family_his_sd_none.setChecked(false);
    		if(cb_pein_family_his_sd_congmal.isChecked()){
    			sd++;
    		}
    		else{
    			sd--;
    			}
    		if(sd>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_sd_congmal.setChecked(false);
				sd--;
    		}
    	}
    	else if(v==cb_pein_family_his_sd_ot){
    		cb_pein_family_his_sd_none.setChecked(false);
    		if(cb_pein_family_his_sd_ot.isChecked()){
    			sd++;
    			et_pein_family_his_sd_ot.requestFocus();
    			et_pein_family_his_sd_ot.setEnabled(true);
    			
    		}
    		else{
    			sd--;
    			et_pein_family_his_sd_ot.setEnabled(false);
    			et_pein_family_his_sd_ot.setText("");
    			}
    		if(sd>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_family_his_sd_ot.setChecked(false);
				sd--;
    		}
    	}
    	else if(v==rb_pein_nonehereditary){
    		if(rb_pein_nonehereditary.isChecked()){
    			et_pein_hereditary_name.setText("");
    			et_pein_hereditary_name.setEnabled(false);
    		}
    	}
    	else if(v==rb_pein_hereditary){
    		if(rb_pein_hereditary.isChecked()){
    			et_pein_hereditary_name.requestFocus();
    			et_pein_hereditary_name.setEnabled(true);
    		}
    	}
    	else if(v==cb_pein_nonedisable){
    		cb_pein_visual_disable.setChecked(false);
    		cb_pein_hear_disable.setChecked(false);
   	 	 	cb_pein_language_disable.setChecked(false);
   	 	 	cb_pein_limbs_disable.setChecked(false);
   	 	 	cb_pein_brains_disable.setChecked(false);
   	 	 	cb_pein_spirit_disable.setChecked(false);
   	 	 	cb_pein_other_disable.setChecked(false);
   	 	 	et_pein_other_disable.setText("");
   	 	 	ds=0;
    	}
    	else if(v==cb_pein_visual_disable){
    		cb_pein_nonedisable.setChecked(false);
    		if(cb_pein_visual_disable.isChecked()){
    			ds++;
    		}
    		else{
    			ds--;
    			}
    		if(ds>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_visual_disable.setChecked(false);
				ds--;
    		}
    	}
    	else if(v==cb_pein_hear_disable){
    		cb_pein_nonedisable.setChecked(false);
    		if(cb_pein_hear_disable.isChecked()){
    			ds++;
    		}
    		else{
    			ds--;
    			}
    		if(ds>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_hear_disable.setChecked(false);
				ds--;
    		}
    	}
    	else if(v==cb_pein_language_disable){
    		cb_pein_nonedisable.setChecked(false);
    		if(cb_pein_language_disable.isChecked()){
    			ds++;
    		}
    		else{
    			ds--;
    			}
    		if(ds>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_language_disable.setChecked(false);
				ds--;
    		}
    	}
    	else if(v==cb_pein_limbs_disable){
    		cb_pein_nonedisable.setChecked(false);
    		if(cb_pein_limbs_disable.isChecked()){
    			ds++;
    		}
    		else{
    			ds--;
    			}
    		if(ds>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_limbs_disable.setChecked(false);
				ds--;
    		}
    	}
    	else if(v==cb_pein_brains_disable){
    		cb_pein_nonedisable.setChecked(false);
    		if(cb_pein_brains_disable.isChecked()){
    			ds++;
    		}
    		else{
    			ds--;
    			}
    		if(ds>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_brains_disable.setChecked(false);
				ds--;
    		}
    	}
    	else if(v==cb_pein_spirit_disable){
    		cb_pein_nonedisable.setChecked(false);
    		if(cb_pein_spirit_disable.isChecked()){
    			ds++;
    		}
    		else{
    			ds--;
    			}
    		if(ds>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_spirit_disable.setChecked(false);
				ds--;
    		}
    	}
    	else if(v==cb_pein_other_disable){
    		cb_pein_nonedisable.setChecked(false);
    		if(cb_pein_other_disable.isChecked()){
    			ds++;
    			et_pein_other_disable.requestFocus();
    			et_pein_other_disable.setEnabled(true);
    		}
    		else{
    			ds--;
    			et_pein_other_disable.setEnabled(false);
    			et_pein_other_disable.setText("");
    			}
    		if(ds>6){
    			Toast.makeText(getContext(), "您最多可选六项",Toast.LENGTH_SHORT).show();
    			cb_pein_other_disable.setChecked(false);
				ds--;
    		}
    	}
    }
    
}